package restlike.demo.royalbankofshoreditch

import im.mange.shoreditch.api.liftweb.ServiceHelper
import ServiceHelper._
import im.mange.shoreditch.api._
import im.mange.shoreditch.api.liftweb.ServiceHelper

//TODO: rename confirmed to received
object Trading extends ServiceHelper(base = "trading", version = "10001")(
  "trade/accepted/@id" check TradeAccepted
)

case class TradeAccepted(id: String) extends Check {
  override def run =
    if (DemoState.trades.exists(b => b.ref == id && b.accepted)) success
    else failure(List(s"Trade $id has not been accepted"))
}
